home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / util / EventObject.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  1.7 KB  |  63 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)EventObject.java    1.10 98/09/27
  3.  *
  4.  * Copyright 1996-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.util;
  16.  
  17. /**
  18.  * <p>
  19.  * The Event class is the abstract root class from which all event state
  20.  * objects shall be derived.
  21.  * <p>
  22.  * All Event's are constructed with a reference to the object, the "source",
  23.  * that is logically deemed to be the object upon which the Event in question
  24.  * initially occurred upon.
  25.  */
  26.  
  27. public class EventObject implements java.io.Serializable {
  28.     /**
  29.      * The object on which the Event initially occurred.
  30.      */
  31.     protected transient Object  source;
  32.  
  33.     /**
  34.      * Constructs a prototypical Event.
  35.      *
  36.      * @param    source    The object on which the Event initially occurred.
  37.      */
  38.     public EventObject(Object source) {
  39.     if (source == null)
  40.         throw new IllegalArgumentException("null source");
  41.  
  42.         this.source = source;
  43.     }
  44.  
  45.     /**
  46.      * The object on which the Event initially occurred.
  47.      *
  48.      * @return   The object on which the Event initially occurred.
  49.      */
  50.     public Object getSource() {
  51.         return source;
  52.     }
  53.  
  54.     /**
  55.      * Returns a String representation of this EventObject.
  56.      *
  57.      * @return  A a String representation of this EventObject.
  58.      */
  59.     public String toString() {
  60.         return getClass().getName() + "[source=" + source + "]";
  61.     }
  62. }
  63.